<script setup lang="ts">
import { toRefs, reactive } from "vue";

const obj = reactive({
  name: "xz",
  age: 23,
});
const change = () => {
  obj.name = "ls";
  console.log(obj);
};

const { name, age } = toRefs(obj);
const change1 = () => {
  obj.name = "wmz";
  obj.age = 28;
};


</script>

<template>
  <div>
    {{ obj }}
  </div>
  <button @click="change">修改</button>
  <h2>{{ name }}--{{ age }}</h2>
  <button @click="change1">修改</button>
</template>

<style scoped></style>
